data = FileAttachment("banking_stats.json").json()
measures = data.map(d => d.Measure).filter(function (e, i, x) {return x.indexOf(e, i+1) === -1;});
sectors = data.map(d => d.Sector).filter(function (e, i, x) {return x.indexOf(e, i+1) === -1;});viewof measure = Inputs.select(measures,
{value: "Total residents assets", label: "Financial Measures", width: 300, multiple: false})viewof sector = Inputs.select(sectors,
{value: "BIG 4", label: "Banking Sectors", width: 300, multiple: true})data_filter = data.filter(x => x.Measure==measure).filter(x => sector.includes(x.Sector));
addTooltips(
Plot.plot({
height: 800,
color: { legend: true },
y: { grid: false, type: "log", label: "Value: $million"},
x: { type: "utc" },
marks: [
Plot.axisX({anchor: "top", label: "Frequency (%) →"}),
Plot.ruleY([0]),
Plot.line(data_filter,
{ x: "Period", y: "ValueMillion", stroke: "Sector",
z: "InstitutionSumm", title: "InstitutionSumm", opacity: 0.5 })
]
}),
{ stroke: "black" }
)